package io.renren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.commons.mybatis.service.impl.CrudServiceImpl;
import io.renren.dao.ProblemSuggestionsDao;
import io.renren.dto.ProblemSuggestionsDTO;
import io.renren.entity.ProblemSuggestionsEntity;
import io.renren.service.ProblemSuggestionsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 问题建议
 *
 * @author liuyujun 384880231@qq.com
 * @since 3.0 2022-01-13
 */
@Service
public class ProblemSuggestionsServiceImpl extends CrudServiceImpl<ProblemSuggestionsDao, ProblemSuggestionsEntity, ProblemSuggestionsDTO> implements ProblemSuggestionsService {

    @Override
    public QueryWrapper<ProblemSuggestionsEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<ProblemSuggestionsEntity> wrapper = new QueryWrapper<>();

        String phone = (String)params.get("phone");
        wrapper.like(StringUtils.isNotBlank(phone), "phone", phone);
        String target = (String)params.get("target");
        wrapper.eq(StringUtils.isNotBlank(target), "target", target);

        return wrapper;
    }


}